import QtQuick 2.12
import QtQuick.Controls 2.12

TextInput {
    id: textEditRoot
    signal textFinished()
    property alias timer: textTimer
    clip: true
    selectByMouse: true
    selectedTextColor: "#4D4D4D"
    selectionColor: "#d7e7ff"
    horizontalAlignment: TextInput.AlignLeft
    verticalAlignment: TextInput.AlignVCenter
    color: "#4D4D4D"
    leftPadding: 5
    font.pixelSize: 10
    focus: true

    onTextChanged: {
        //console.log("text: ", text)
    }

    Keys.onReturnPressed: {
        deselect()
        textFinished()
    }

    Keys.onEnterPressed: {
        deselect()
        textFinished()
    }

    Timer {
        id: textTimer
        repeat: true
        interval: 400
        running: false
        onTriggered: {
            if(cursorVisible === false) {
                stop()
                visible = false
                textFinished()
            }
        }
    }
}
